// #include<stdio.h>
// int main()
// {
//     int a = 1;
//     int x = ~a;
//     printf("%d\n",x);   
// }

// #include<stdio.h>
// int main ()
// {
//     unsigned int male = 0x1;   
//     unsigned int french = 0x2;
//     unsigned int german = 0x4;
//     unsigned int italian = 0x8;
//     unsigned int payBracket = 0x10; 
//     return 0;
// }
//18:12 19:13 20:14 21:15 22:16 23:17 24:18 25:19 26:1A 27:1B 28:1C 29:1D 30:1E 31:1F 32:20
// #include<stdio.h>
// int main()
// {
//     //不用临时变量的交换变量
//     int x,y;  //申明x，y
//     x ^=y;    //x装入3
//     y =x ^ y;  //y装入1
//     x ^=y;    //x装入2
// }

//目的：做一个返回结果的计算器
//结构：申明，提示语，输入，操作

#include<stdio.h>
int main()
{
    //申请number1、2和操作符空间
    double number1 = 0.0;
    double number2 = 0.0;
    char operation = 0;

    //输入number1、操作符、number2
    printf("请输入运算式子，如：1+1.\n");
    scanf("%lf %c %lf",&number1,&operation,&number2);

    //+、-、*、/、%、默认操作
    switch(operation)
    {
        break;
        case '-':printf("\n=%lf\n",number1 - number2);
        break;
        case '*':printf("\n=%lf\n",number1 + number2);
        break;
        case '/':
        if(number2 == 0)
        printf("\n不能除以0\n");
        else
        printf("\n=%lf\n",number1 / number2);
        break;
        case '%':
        if((long)number2 == 0)
        printf("\n不能除以0\n");
        else
        printf("\n=%ld\n",(long)number1 % (long)number2);
        break;
        default:
        printf("\n\n\a非法输入\n");
    }


}
